Repository navigation
Conversation
When an upload's PUT loses its connection before S3 responds, urllib3 resends it today. imap-data-access's new retry policy removes that resend, since resending an upload blindly has side effects, so the "Connection aborted" error would reach upload_products and fail the job. Restore the retry one level up: treat that error like a 503 SlowDown and run the whole upload again, which skips a file S3 already stored (409 FileAlreadyExists), and exit with RETRY_EXIT_CODE if it keeps failing.
Contributor
|
This looks good to me! We should probably also do this for the download api call right? Although I just checked and seems like we dont have any retry handling in place for that yet. I just added a new Issue |
lacoak21
approved these changes
Nov 5, 2026
Contributor
|
This looks fine. One question I have about exiting with |
Contributor
|
The exit code should work with dagster because it only will fail or succeed when the batch job fails or succeeds. A batch job's status is only ever set to failed or succeeded when all of its retries are up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
Overview
Today, when an upload's PUT to S3 loses its connection before S3 responds, urllib3 resends it automatically. IMAP-Science-Operations-Center/imap-data-access#373 removes that resend, because resending an upload blindly has side effects. On its own, that change would turn a dropped upload connection into a failed job:
upload_productswould re-raise the error, and the job would exit with code 1, which Batch wouldn't retry.This PR restores the retry one level up.
upload_productsnow handles a dropped connection like a 503 SlowDown: it reruns the wholeupload(), for up to 3 attempts in all, then exits withRETRY_EXIT_CODEso Batch reruns the job. Unlike resending the PUT, rerunning the upload checks first: the upload API returns 409 FileAlreadyExists if S3 already has the file, whichupload_productsalready skips.It works with imap-data-access 1.3.0 too, and should merge before the new release: the processing images
pip installimap_processing from git, so they get the newest imap-data-access rather than the one inpoetry.lock.Unsurprisingly, I had Claude's help writing/understanding this fix. It seems like the right move to me—I don't want my IMAP-Science-Operations-Center/imap-data-access#373 to be the reason jobs start failing—but I welcome feedback on this approach.
File changes
imap_processing/cli.py: retry upload errors containing "Connection aborted", and show the error in the retry warning.imap_processing/tests/test_cli.py: parametrize the 503 test (nowtest_post_processing_upload_retryable_error) over SlowDown and a dropped connection, and add a test for a retry that finds the file already stored.Testing
All 60 tests in
test_cli.pypass, and the new cases fail without the fix. I also ranupload_productsend to end against both imap-data-access versions, mocking only urllib3's connection pool.